<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%>
<%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>湖北职院财务信息查询系统</title>
<LINK href="style/css.css" type="text/css" rel="stylesheet">
<script type="text/javascript">

	function checkForm() {
		var deptId = document.getElementById("deptId").value;
		var deptName = document.getElementById("deptName").value;
				
		if (deptId == 0) {
			alert("请输入部门编号！");
			return false;
		}
		if (deptName == 0) {
			alert("请输入部门名称！");
			return false;
		}
	}

	function deleate(id){
		if (confirm("删除此数据后可能导致操作异常,您确定要删除此条信息？")){
		window.location.href='department.do?method=delete&id='+id;
		}
		return false;
	}
</script>
</head>
<body>
<table class="tableline" cellspacing="1" cellpadding="0" width="80%"
	border="0" align="center">
	<html:form action="department.do?method=save" method="post"
		onsubmit="return checkForm();">
		<tr>
			<td class="STYLE4" align="center" bgcolor="#ffffff" colspan="2"
				height="40">添加修改部门</td>
		</tr>
		<tr>
			<td width="40%" height="30" align="right" bgcolor="#ffffff">部门代码:</td>
			<td bgcolor="#ffffff"><label for="textfield"></label> &nbsp;<html:text
				property="deptId" value="${dept.deptId }" /> <font color="red">${deptIdError
			}${deptIdRequest }</font></td>
		</tr>
		<tr>
			<td height="30" align="right" bgcolor="#ffffff">部门名称:</td>
			<td bgcolor="#ffffff"><label for="textfield2"></label> &nbsp;<html:text
				property="deptName" value="${dept.deptName }" /> &nbsp;<html:submit
				value="增加部门" />&nbsp;<font color="red">${deptNameError }</font></td>
		</tr>
	</html:form>
</table>
<br />
<table id="Table4" cellspacing="1" cellpadding="1" width="80%"
	bgcolor="#999999" align="center" bordercolor="#ffffff" border="1">
	<tr align="center" bgcolor="#FFFFFF">
		<td width="25%" height="25"><font color="#000000"><b>部门代码</b></font></td>
		<td width="25%"><font color="#000000"><b>部门名称</b></font></td>
		<td width="25%"><font color="#000000"><b>操作</b></font></td>
	</tr>
	<c:if test="${!empty deptList}">
		<c:forEach items="${deptList}" var="dept">
			<tr align="center" bgcolor="#FFFFFF">
				<td height="25">${dept.deptId }</td>
				<td>${dept.deptName}</td>
				<td><a href="department.do?method=update&id=${dept.id }">编辑</a>&nbsp;<a
					href="javascript:void(0);" onClick="deleate(${dept.id })">删除</a></td>
			</tr>
		</c:forEach>
	</c:if>
</table>
</body>
</html>